#ifndef _COM_SERVICE_H_
#define _COM_SERVICE_H_

#include "rtask.h"

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include<termios.h>  

#include <iostream>
#include <vector>
#include <queue>
#include <map>
using namespace std ;

#define com_device "/dev/ttyS0" 
#define com_baudrate B4800

class com_task  : public rtask
{
	public :
		com_task() :  ms_sn(""), ms_version(""), ms_vender(""){}
		~com_task()
		{
			ms_sn.clear();
			ms_version.clear();
			ms_vender.clear();
		}

		string ms_sn;
		string ms_version;
		string ms_vender;
} ;


class com_service
{
	private :
		com_service() ;
		virtual ~com_service() ;

		com_service(const com_service&);
		com_service& operator=(const com_service&);		
		
	public:
		static com_service& _instance()
		{
			static com_service instance ;
			return instance ;
		}

		bool start() ;
		
		bool connect();
		bool do_get_args();
		bool write(const vector<unsigned char>& v_data);

		com_task m_task ;
} ;

#endif

